package com.foxmail.aroundme.boring.module.news.newslistbean;

import android.content.Context;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bumptech.glide.Glide;
import com.foxmail.aroundme.boring.BuildConfig;
import com.foxmail.aroundme.boring.R;
import com.foxmail.aroundme.boring.bean.entry.NewsEntry;
import com.foxmail.aroundme.boring.bean.newslist.NewsListBean;
import com.foxmail.aroundme.boring.utils.Config;
import com.foxmail.aroundme.mutlitype.ItemViewProvider;
import com.socks.library.KLog;

/**
 * Created by gzl on 1/22/17.
 *
 */

public class NewsProvider extends ItemViewProvider<NewsEntry, NewsViewHolder>{

    private Context context;

    @NonNull
    @Override
    protected NewsViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {

        View view = inflater.inflate(R.layout.item_news, parent, false);

        context = inflater.getContext();
        return new NewsViewHolder(view);
    }

    @Override
    protected void onBindViewHolder(@NonNull NewsViewHolder holder, @NonNull NewsEntry newsEntry) {

        holder.newsTitle.setText(newsEntry.newsTitle);
        holder.newsSource.setText(newsEntry.newsAuthor_name);

        Glide.with(context).load(newsEntry.newsPicture1).into(holder.newsImg1);
        Glide.with(context).load(newsEntry.newsPicture2).into(holder.newsImg2);
        Glide.with(context).load(newsEntry.newsPicture3).into(holder.newsImg3);
    }
}
